/*
 * @Date: 2023-08-02 01:35:07
 * @LastEditors: zhangsongwei
 * @LastEditTime: 2023-08-06 02:00:12
 * @FilePath: /z/src/urls/p.ts
 * @description:
 */

import { get, post } from "../service/tools";
import * as config from "../service/config";

const baseUrl = "http://120.27.136.21:8800";

export const getMenuList = (name: string) => {
  return get({
    url: baseUrl + "/permission/getMenuList",
    config: { params: { name } },
  });
};

//class
export const getAllType = () => get({ url: baseUrl + "/class/getAllType" });
export const getClass = (type: String) => {
  if (type) {
    return get({
      url: baseUrl + "/class/getClass",
      config: { params: { type } },
    });
  } else {
    return get({ url: baseUrl + "/class/getClass" });
  }
};
export const updateClass = (data: any) =>
  post({ url: baseUrl + "/class/updateClass", data });
export const addClass = (data: any) =>
  post({ url: baseUrl + "/class/addClass", data });

//
export const getSubClass = (classId?: string) => {
  return get({
    url: baseUrl + "/subClass/getClass",
    config: { params: { classId } },
  });
};

export const addSubClass = (data: any) =>
  post({ url: baseUrl + "/subClass/addClass", data });

export const updateSubClass = (data: any) =>
  post({ url: baseUrl + "/subClass/updateClass", data });
export const getCityList = () =>
  post({ url: baseUrl + "/subClass/getCityList" });
export const editInfo = (data: any) =>
  post({ url: baseUrl + "/subClassDetail/editInfo", data });

//
export const getUserList = () =>
  get({ url: baseUrl + "/permission/getUserList" });
export const addUser = (data: any) =>
  post({ url: baseUrl + "/login/addUser", data });
export const addUserPermission = (data: any) =>
  post({ url: baseUrl + "/permission/addUserPermission", data });

export const getRandomPassword = () =>
  get({ url: baseUrl + "/login/getRandomPassword" });

//
export const getBasic = () => get({ url: baseUrl + "/board/getBasic" });
export const getMapInfo = () => get({ url: baseUrl + "/board/getMapInfo" });
//
export const getInfo = (subClassId?: string) =>
  get({
    url: baseUrl + "/eventUser/getInfo",
    config: { params: { subClassId } },
  });

export const addClassInfo = (data: any) =>
  post({ url: baseUrl + "/eventUser/addInfo", data });

export const updateInfo = (data: any) =>
  post({ url: baseUrl + "/eventUser/editInfo", data });
